home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / syntax / asm.vim < prev    next >
Encoding:
Text File  |  2001-05-09  |  2.6 KB  |  104 lines

  1. " Vim syntax file
  2. " Language:    GNU Assembler
  3. " Maintainer:    Kevin Dahlhausen <ap096@po.cwru.edu>
  4. " Last Change:    2001 May 09
  5.  
  6. " For version 5.x: Clear all syntax items
  7. " For version 6.x: Quit when a syntax file was already loaded
  8. if version < 600
  9.   syntax clear
  10. elseif exists("b:current_syntax")
  11.   finish
  12. endif
  13.  
  14. syn case ignore
  15.  
  16.  
  17. " storage types
  18. syn match asmType "\.long"
  19. syn match asmType "\.ascii"
  20. syn match asmType "\.asciz"
  21. syn match asmType "\.byte"
  22. syn match asmType "\.double"
  23. syn match asmType "\.float"
  24. syn match asmType "\.hword"
  25. syn match asmType "\.int"
  26. syn match asmType "\.octa"
  27. syn match asmType "\.quad"
  28. syn match asmType "\.short"
  29. syn match asmType "\.single"
  30. syn match asmType "\.space"
  31. syn match asmType "\.string"
  32. syn match asmType "\.word"
  33.  
  34. syn match asmLabel        "[a-z_][a-z0-9_]*:"he=e-1
  35. syn match asmIdentifier        "[a-z_][a-z0-9_]*"
  36.  
  37. " Various #'s as defined by GAS ref manual sec 3.6.2.1
  38. " Technically, the first decNumber def is actually octal,
  39. " since the value of 0-7 octal is the same as 0-7 decimal,
  40. " I prefer to map it as decimal:
  41. syn match decNumber        "0\+[1-7]\=[\t\n$,; ]"
  42. syn match decNumber        "[1-9]\d*"
  43. syn match octNumber        "0[0-7][0-7]\+"
  44. syn match hexNumber        "0[xX][0-9a-fA-F]\+"
  45. syn match binNumber        "0[bB][0-1]*"
  46.  
  47.  
  48. syn match asmSpecialComment    ";\*\*\*.*"
  49. syn match asmComment        ";.*"hs=s+1
  50.  
  51. syn match asmInclude        "\.include"
  52. syn match asmCond        "\.if"
  53. syn match asmCond        "\.else"
  54. syn match asmCond        "\.endif"
  55. syn match asmMacro        "\.macro"
  56. syn match asmMacro        "\.endm"
  57.  
  58. syn match asmDirective        "\.[a-z][a-z]\+"
  59.  
  60.  
  61. syn case match
  62.  
  63. " Define the default highlighting.
  64. " For version 5.7 and earlier: only when not done already
  65. " For version 5.8 and later: only when an item doesn't have highlighting yet
  66. if version >= 508 || !exists("did_asm_syntax_inits")
  67.   if version < 508
  68.     let did_asm_syntax_inits = 1
  69.     command -nargs=+ HiLink hi link <args>
  70.   else
  71.     command -nargs=+ HiLink hi def link <args>
  72.   endif
  73.  
  74.   " The default methods for highlighting.  Can be overridden later
  75.   HiLink asmSection    Special
  76.   HiLink asmLabel    Label
  77.   HiLink asmComment    Comment
  78.   HiLink asmDirective    Statement
  79.  
  80.   HiLink asmInclude    Include
  81.   HiLink asmCond    PreCondit
  82.   HiLink asmMacro    Macro
  83.  
  84.   HiLink hexNumber    Number
  85.   HiLink decNumber    Number
  86.   HiLink octNumber    Number
  87.   HiLink binNumber    Number
  88.  
  89.   HiLink asmSpecialComment Comment
  90.   HiLink asmIdentifier Identifier
  91.   HiLink asmType    Type
  92.  
  93.   " My default color overrides:
  94.   " hi asmSpecialComment ctermfg=red
  95.   " hi asmIdentifier ctermfg=lightcyan
  96.   " hi asmType ctermbg=black ctermfg=brown
  97.  
  98.   delcommand HiLink
  99. endif
  100.  
  101. let b:current_syntax = "asm"
  102.  
  103. " vim: ts=8
  104.